package com.cn.pg.config;

public class MyRoutingDataSourceContext {

    static ThreadLocal<String> threadLocal = new ThreadLocal<>();

    public MyRoutingDataSourceContext(String key){
        threadLocal.set(key);
    }

    public static String get(){
        return threadLocal.get() == null ? "master" : threadLocal.get();
    }

    public void close(){
        threadLocal.remove();
    }
}
